import Taro, { Component } from '@tarojs/taro'
import { Swiper, SwiperItem, Image, View, Text } from '@tarojs/components'
import Goodshearder from './goodshearder'
import '../../assets/common.scss'
import CommonJs from '../../utils/common'
import './unpaid.scss'

export default class Index extends Component {
  constructor(props) {
  	super(props);
    this.state = {
      navindex:'UNPAID',//用于判断导航选中
      wldate:[],
      pageheight:0,
	  	pageNumber:0,//页码数
      scrollPd:false,//是否可滑动
      hasNextPage:false,//是否有下一页
		  malltype:'',
		  isshow:0,
		  appmark:CommonJs.getmark(),
    }
  }
  config = {
    navigationBarTitleText: '查看物流信息'
  }

  componentWillMount () {
		var id=this.$router.params.id
		var type=this.$router.params.type
  	this.getdate(id,type)
  }
  componentDidMount () {}
  componentDidShow () {}
  getdate(id,type){
  	var url='/order/papi/v1.9/logistics/findOrderLpcPackPub'
  	var dates={
  		entityType:type,
		  "orderId":id
		}
  	var _this=this;
  	CommonJs.ajaxRequest(url,dates,'POST',function(res){
  		_this.setState({
		    wldate: res.data,
		    isshow:1
		  })
  	})
  }
  render () {
    const wldate = this.state.wldate
    return (
      <View className='page' style={this.state.isshow==1?'':'display:none'}>
      	<View className='wlinfo' style={wldate?'':'display:none'}>
	        <View className='unpaid-content' style="background-color:#fff;border-bottom:10px solid #eee">
	          <View className='unpaid-goods'>
							<View className='unpaid-pic'>
								<Image mode='scaleToFill' className='unpaid-pic-img' src={wldate.orderVM.orderItemVMS[0].itemPicture}></Image>
			        </View>
							<View className='unpaid-right'>
			          <View className='unpaid-goodsname'>{wldate.orderVM.orderItemVMS[0].itemName}等{wldate.orderVM.orderItemVMS.length}件商品</View>
			          <View className='unpaid-specifications'>
			          	<View className='unpaid-num'>发货门店：{wldate.shopName}</View>
			          	<View className='unpaid-price'>{wldate.logisticsStatusDesc}</View>
			          </View>
			        </View>
			      </View>
	        </View>
	        <View className='unpaid-content' style="background-color:#fff;border-bottom:10px solid #eee">
	          <View className='unpaid-goods'>
							<View className='unpaid-pic' style='border-radius:120rpx;'>
								<Image mode='scaleToFill' className='unpaid-pic-img' src={wldate.locpCode.logo}></Image>
			        </View>
							<View className='unpaid-right' style="margin-top:20rpx">
			          <View className='unpaid-goodsname'>{wldate.locpCode.name}</View>
			          <View className='unpaid-specifications'>
			          	<View className='unpaid-num'>{wldate.locpCode.phone?wldate.locpCode.phone:wldate.locpCode.title}</View>
			          </View>
			        </View>
			      </View>
	        </View>
	        <View className='wlbox'>
	        	<View className='wlbox-tit'>物流单号:{wldate.mailNo}</View>
	        	<View className='wlbox-ul'>
	        		{wldate&&wldate.fullTraceDetail&&wldate.fullTraceDetail.map((item, index) => (
	        		<View className={index==0?'wlbox-li wlbox-lic':'wlbox-li'}>
	        			<View className='wlbox-li-con'>{item.desc}</View>
	        			<View className='wlbox-li-time'>{item.time}</View>
	        		</View>
	        		))}
	        	</View>
	        </View>
	      </View>
	      <View className='wlinfo' style={wldate?'display:none':''}>
	      	<View className='nodate'>暂无物流信息</View> 
	      </View>
      </View>
    )
  }
}
